package com.killer.io;

import com.killer.util.HttpProtocolUtil;

import java.io.IOException;
import java.io.OutputStream;

/**
 * @author ：Killer
 * @date ：Created in 20-11-10 下午3:55
 * @description：${description}
 * @modified By：
 * @version: version
 */
public class HttpOutputStream extends OutputStream{

    private OutputStream outputStream;

    public HttpOutputStream(OutputStream outputStream) {
        this.outputStream = outputStream;
    }


    @Override
    public void write(int b) throws IOException {
        outputStream.write(b);
    }

    public void write(byte b[]) throws IOException {
        //先输出响应头
        outputStream.write(HttpProtocolUtil.getRep200Header(b.length).getBytes());
        outputStream.write(b);
    }
}
